/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ez2find.model;

import java.io.Serializable;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;

/**
 *
 * @author Owner
 */
@NamedQueries(value={@NamedQuery(name="listAllSales", query="SELECT s FROM Sale s"),
                     @NamedQuery(name="lastSaleCode", query="SELECT MAX(s.code) FROM Sale s")})

@Entity
public class Sale extends Post implements Serializable{

    private String saleType;
    private double price;
    //Permissions
    private boolean othersContact;
    @ManyToOne()
    private CategoriaVenta saleCategorie;
    @OneToMany(mappedBy="sale",cascade=CascadeType.REMOVE)
    private List<Image> images;
    private boolean img;
    
    public boolean getOthersContact() {
        return othersContact;
    }

    public void setOthersContact(boolean othersContact) {
        this.othersContact = othersContact;
    }

    public String getSaleType() {
        return saleType;
    }

    public void setSaleType(String saleType) {
        this.saleType = saleType;
    }

    public List<Image> getImages() {
        return images;
    }

    public void setImages(List<Image> images) {
        this.images = images;
    }

    public boolean isImg() {
        return img;
    }

    public void setImg(boolean img) {
        this.img = img;
    }

    public CategoriaVenta getSaleCategorie() {
        return saleCategorie;
    }

    public void setSaleCategorie(CategoriaVenta saleCategorie) {
        this.saleCategorie = saleCategorie;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

}
